<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- ⿏标点击⻚⾯出现随机颜⾊的⽂字，出现之后向上淡出。 -->
    <style>
        p{
            text-align: center;
            color:yellow;
            font-size: 30px;
            font-weight: bolder;
        }
    </style>
</head>
<body >
    <!-- 设置按钮 -->
    <button onclick="str()"> qqw</button>
    <p id="p"></p>
    <script>
      
        function suiJi(m,n){
            return m+parseInt(Math.random()*(n-m+1))
        }
        //随机生成m-n之间的整数，包含m，n
        function yanSe(){
            var result = "#"
            for(var i = 0; i<6; i++){
                result +=suiJi(0,15).toString(16)
            }
        return result;
        //生成一个随机颜色编码#000000-#ffffff
        }
        var x = 'Hello Word'

        var p =  document.getElementById("p").innerHTML = x
        //获取节点
       function str(){
          p.style.color = yanSe()
        }
    </script>
</body>
</html>
